package com.sky.controller.admin;

import com.sky.dto.OrdersPageQueryDTO1;
import com.sky.result.PageResult;
import com.sky.result.Result;
import com.sky.service.OrderService;
import com.sky.vo.OrderChaKanVO;
import com.sky.vo.OrderStatusVO;
import com.sky.vo.OrdersPageVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin/order")
public class AdminOrderController {
    @Autowired
    private OrderService orderService;
    /**
     * 订单搜索
     *
     */

    @GetMapping("/conditionSearch")
    public Result<PageResult<OrdersPageVO>>page(OrdersPageQueryDTO1 ordersPageQueryDTO1){
        PageResult<OrdersPageVO> page=orderService.page(ordersPageQueryDTO1);
        return Result.success(page);

    }
    /**
     * 查看订单详情
     * */
    @GetMapping("details/{id}")
    public Result<OrderChaKanVO>chakan(@PathVariable Integer id){
       OrderChaKanVO vo= orderService.chakan(id);
       return Result.success(vo);
    }
    /**
     * 查看各个订单的数量
     * */
    @GetMapping("/statistics")
    public Result<OrderStatusVO>status(){
       OrderStatusVO vo= orderService.status();
       return Result.success(vo);


    }



}
